//! FACET COMMON DECLARATIONS
boolean foEDCsetup=false;

void ShuffleSet() {
}
void facetGo() {
  if (knownFacet != 16) {
    FacetAct=true;
    goFacet=knownFacet;
  } else { 
    FacetAct=false;
  }
  int launch=-1;
  for (int i =0; i<facets.length;i++) {
    if (facets[i]==1) {
      launch =i;
      println("this is the launch code: "+i);
      break;
    }
  }
  System.gc();  // *** does this do anything at all?
  switch (launch) {
  case 0:
    if (f_bloom.isActive) {
      f_bloom.restartFO();
    }
    else {
      f_bloom.setupFO();
    }
    break;
  case 2:
    break;
  case 13:
    f_edc.setupFO();
    println("should launch EDC");
    break;  

  case 14:
    setupFireWorksFF();
    fireWorksFacet=true;
    println("should launch fireworks");
    break;  
  case 15:
    f_flower.setupFO();
  default:
    break;
  }
}
void oscRotZero() {
  OscMessage initOSC;
  initOSC=new OscMessage("/MAIN/spinDirect");
  initOSC.add("0");
  oscP5x.send(initOSC, Conductor);
        if (goFacet==100) {
        initOSC=new OscMessage("/PLAN/degree");
      }
      else {
        initOSC=new OscMessage("/MAIN/degree");
      }
  initOSC.add("0");
  oscP5x.send(initOSC, Conductor);
  oscRot=0;
}
void rotCTRLs() {
  OscMessage echoControl;
  echoControl=new OscMessage("/MAIN/degree/visible");
  echoControl.add(int(!rotLoc));
  oscP5x.send(echoControl, Conductor);
  echoControl=new OscMessage("/MAIN/spinDirect/visible");
  echoControl.add(int(!rotLoc));
  oscP5x.send(echoControl, Conductor);
  echoControl=new OscMessage("/MAIN/rotZero/visible");
  echoControl.add(int(!rotLoc));
  oscP5x.send(echoControl, Conductor);
}
void envSetup() {

  OscMessage initOSC;
  oscRotZero();
  rotCTRLs();
  initOSC=new OscMessage("/MAIN/spinDirect");
  initOSC.add("0");
  oscP5x.send(initOSC, Conductor);
  oscRot=0;
  positionWindow(5, 0);
  rotLoc=true;
  rotLim=true;
  rotCTRLs();
  initOSC=new OscMessage("/MAIN/degree/visible");
  initOSC.add("0");
  oscP5x.send(initOSC, Conductor);
  initOSC=new OscMessage("/MAIN/rotLoc");
  initOSC.add("1.0");
  oscP5x.send(initOSC, Conductor);
  initOSC=new OscMessage("/MAIN/rotLim");
  initOSC.add("1");
  oscP5x.send(initOSC, Conductor);

  facetName[0]="Bloom";
  facetName[13]="EDC";
  facetName[14]="FireWorks";
  facetName[15]="Flower";
  facetName[16]="NONE";
  /* ##future programming my retrieve facet names programatically:
   facetName=loadStrings("facetNames.txt");  */
  int i =0;
  for (i =0; i<17; i++) {
    initOSC= new OscMessage("/MAIN/FL"+i);
    if (facetName[i]==null) {
      facetName[i]="";
    }
    initOSC.add(facetName[i]);
    oscP5x.send(initOSC, Conductor);
  }
}
